/* Enhanced UI - Modern Design System */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&display=swap');

/* Global Variables */
:root {
  --primary-50: #eff6ff;
  --primary-100: #dbeafe;
  --primary-200: #bfdbfe;
  --primary-300: #93c5fd;
  --primary-400: #60a5fa;
  --primary-500: #3b82f6;
  --primary-600: #2563eb;
  --primary-700: #1d4ed8;
  --primary-800: #1e40af;
  --primary-900: #1e3a8a;
  
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  
  --success-50: #ecfdf5;
  --success-500: #10b981;
  --success-600: #059669;
  
  --warning-50: #fffbeb;
  --warning-500: #f59e0b;
  --warning-600: #d97706;
  
  --error-50: #fef2f2;
  --error-500: #ef4444;
  --error-600: #dc2626;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  
  --radius-sm: 6px;
  --radius: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;
  
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', ui-monospace, SFMono-Regular, monospace;
  
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Enhanced Animations */
@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes bounceIn {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }
  50% {
    opacity: 1;
    transform: scale(1.05);
  }
  70% {
    transform: scale(0.9);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes shimmer {
  0% {
    background-position: -200px 0;
  }
  100% {
    background-position: calc(200px + 100%) 0;
  }
}

/* Enhanced Button Styles */
.btn-enhanced {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.2rem;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  text-align: center;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  overflow: hidden;
  user-select: none;
  white-space: nowrap;
}

.btn-enhanced::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.2) 50%, transparent 70%);
  transform: translateX(-100%);
  transition: transform 0.6s;
}

.btn-enhanced:hover::before {
  transform: translateX(100%);
}

.btn-enhanced:focus {
  outline: none;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.btn-enhanced:active {
  transform: translateY(1px);
}

/* Button Variants */
.btn-primary {
  background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
  color: white;
  border-color: var(--primary-600);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.btn-secondary {
  background: linear-gradient(135deg, var(--gray-50), var(--gray-100));
  color: var(--gray-700);
  border-color: var(--gray-300);
}

.btn-secondary:hover {
  background: linear-gradient(135deg, var(--gray-100), var(--gray-200));
  transform: translateY(-1px);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.8);
  color: var(--gray-700);
  border-color: var(--gray-200);
}

.btn-ghost:hover {
  background: var(--gray-50);
  transform: translateY(-1px);
}

/* Enhanced Input Styles */
.input-enhanced {
  width: 100%;
  padding: 0.75rem 0.9rem;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  color: var(--gray-900);
  background: white;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-md);
  transition: var(--transition);
  outline: none;
}

.input-enhanced:focus {
  border-color: var(--primary-500);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
  transform: translateY(-1px);
}

.input-enhanced::placeholder {
  color: var(--gray-400);
  font-weight: 400;
}

/* Enhanced Card Styles */
.card-enhanced {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  transition: var(--transition);
  overflow: hidden;
}

.card-enhanced:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

/* Enhanced Modal/Dialog Styles */
.modal-backdrop {
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(12px);
  animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background: linear-gradient(145deg, #ffffff, #f8fafc 60%, #f1f5f9);
  border-radius: var(--radius-xl);
  box-shadow: 0 25px 60px -12px rgba(15, 23, 42, 0.5), 0 10px 35px -8px rgba(15, 23, 42, 0.4);
  animation: modalSlideIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalSlideIn {
  0% {
    opacity: 0;
    transform: translateY(-40px) scale(0.9);
  }
  60% {
    opacity: 1;
    transform: translateY(0) scale(1.02);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Enhanced Typography */
.heading-enhanced {
  font-family: var(--font-sans);
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--gray-900);
}

.text-enhanced {
  font-family: var(--font-sans);
  color: var(--gray-700);
}

/* Icon Enhancement */
.icon-enhanced {
  width: 1rem;
  height: 1rem;
  stroke-width: 2;
  transition: var(--transition-fast);
}

.icon-enhanced:hover {
  transform: scale(1.1);
}

/* Loading States */
.loading-shimmer {
  background: linear-gradient(90deg, var(--gray-200) 25%, var(--gray-100) 50%, var(--gray-200) 75%);
  background-size: 200px 100%;
  animation: shimmer 2s infinite;
}

/* Utility Classes */
.animate-slide-up {
  animation: slideInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.animate-slide-down {
  animation: slideInDown 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.animate-fade-scale {
  animation: fadeInScale 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.animate-bounce-in {
  animation: bounceIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Responsive Design Helpers */
@media (max-width: 640px) {
  .btn-enhanced {
    padding: 0.6rem 1rem;
    font-size: 13px;
  }
  
  .input-enhanced {
    padding: 0.7rem 0.8rem;
    font-size: 13px;
  }
}


/* Accessibility Improvements */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Unified Close Button */
.ui-close-btn {
  --btn-size:34px;
  position:relative;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:var(--btn-size);
  height:var(--btn-size);
  padding:0;
  background:transparent;
  border:none;
  border-radius:10px;
  cursor:pointer;
  color:var(--gray-600);
  transition:background .22s, color .22s, transform .35s cubic-bezier(.4,0,.2,1);
}
.ui-close-btn .icon-x { width:18px; height:18px; stroke:currentColor; stroke-width:2.1; transition:transform .25s cubic-bezier(.4,0,.2,1); }
.ui-close-btn:hover { background:linear-gradient(135deg,#fee2e2,#fecaca); color:var(--error-600); }
.ui-close-btn:hover .icon-x { transform:rotate(90deg); }
.ui-close-btn:active { transform:scale(.9); }
.ui-close-btn:focus-visible { outline:2px solid var(--primary-400); outline-offset:2px; }
.ui-close-btn.alt { --btn-size:30px; }

/* Focus Visible for Better Keyboard Navigation */
.btn-enhanced:focus-visible,
.input-enhanced:focus-visible {
  outline: 2px solid var(--primary-500);
  outline-offset: 2px;
}